package cn.edu.nsmc.modules.sys.dao;

import cn.edu.nsmc.modules.sys.entity.SysHomepagePush;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SysHomepagePushDao {
    @Select("SELECT * FROM sys_homepage_push WHERE id = #{id}")
    SysHomepagePush getById(@Param("id") Long id);

    List<SysHomepagePush> getAll(String title,Integer page, Integer size);

    @Insert("INSERT INTO sys_homepage_push(id,title, content, image_url, link_url, create_time, update_time, is_active) " +
            "VALUES(null,#{title}, #{content}, #{imageUrl}, #{linkUrl}, #{createTime}, #{updateTime}, #{isActive})")
    //@Options(useGeneratedKeys = true, keyProperty = "id")
    Integer insert(SysHomepagePush sysHomepagePush);

    @Update("UPDATE sys_homepage_push SET title = #{title}, content = #{content}, image_url = #{imageUrl}, link_url = #{linkUrl}, " +
            "create_time = #{createTime}, update_time = #{updateTime}, is_active = #{isActive} WHERE id = #{id}")
    Integer update(SysHomepagePush sysHomepagePush);

    @Delete("DELETE FROM sys_homepage_push WHERE id = #{id}")
    Integer delete(@Param("id") Long id);

    Integer count(String title);
}
